// JavaScript Document
//首页js

function showmenu(id){
	for(var i=1; i<=9; i++){
		document.getElementById("menu"+i).style.display = "none";
	}
	document.getElementById("menu"+id).style.display = "block";
}

//随着滚动条一起滑动
window.onscroll = function(){
	var sh = document.body.scrollTop;
	var ch = document.getElementById("ad").offsetHeight;
	var headCH = document.getElementById("header").offsetHeight;
	var head =  parseInt(ch) + parseInt(headCH) + 38;
	var adClass = document.getElementById("ad").style.display;
	
	if(sh >= ch){
		document.getElementById("top").className = "top2";
		document.getElementById("bigtop").className = "bigtop2";
		
		if(adClass == 'none'){
			for(var i=1; i<=9; i++){
				document.getElementById('submenu'+i).style.top = "228px";
			}
		}else{
			for(var i=1; i<=9; i++){
				document.getElementById('submenu'+i).style.top = "308px";
			}
		}
	}
	
	if(sh <= ch ){
		document.getElementById("top").className = "top";
		document.getElementById("bigtop").className = "bigtop";
		
		if(adClass == 'none'){
			for(var i=1; i<=9; i++){
				document.getElementById('submenu'+i).style.top = "262px";
			}
		}else{		
			for(var i=1; i<=9; i++){
				document.getElementById('submenu'+i).style.top = "342px";
			}
		}
	}
	
	if(sh >= head){
		document.getElementById("header").style.display = "block";
	}
	
	if(sh <= head){
		document.getElementById("header").style.display = "none";
	}
} 